package com.example.springbootjpa.controller;

import com.example.springbootjpa.dao.UcUserAccountNetDao;
import com.example.springbootjpa.entity.UcUserAccountNet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TestController {
    @Autowired
    private UcUserAccountNetDao ucUserAccountNetDao;
    /**
    * @Description:
    * @Param: [] 
    * @return: java.lang.String 
    */ 
    @RequestMapping("/test")
    public String test()
    {
        //查询一条
        UcUserAccountNet account =  ucUserAccountNetDao.getOne(1L);
        System.out.println(account.getCertKey());

        //新增一条
//        UcUserAccountNet net = new UcUserAccountNet();
//        net.setCertKey("tesssss");
//        net.setCertNo("12349999999");
//        ucUserAccountNetDao.save(net);

        //
        UcUserAccountNet net2 = new UcUserAccountNet();
        net2.setUserId(1L);
        net2.setUserName("javk");
        ucUserAccountNetDao.saveAndFlush(net2);

        List<UcUserAccountNet> netList = ucUserAccountNetDao.findByUserName("javk");
        System.out.println(netList.get(0).getUserId());

        return "hehe";
    }

    /** 
    * @Description:  
    * @Param: [] 
    * @return: java.lang.String 
    */ 
    public String test2(){
        return "a";
    }
}
